

<%@ page import="com.webboard.Post" %>
<html>
  <head>
  <resource:richTextEditor type="full" />
  <resource:tabView />
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta name="layout" content="main" />
  <g:set var="entityName" value="${message(code: 'post.label', default: 'Post')}" />
  <title><g:message code="default.create.label" args="[entityName]" /></title>
</head>
<body>
  <div class="nav">
    <span class="menuButton"><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></span>
  </div>
  <div class="body">
    <h1><g:message code="default.create.label" args="[entityName]" /></h1>
    <g:if test="${flash.message}">
      <div class="message">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${postInstance}">
      <div class="errors">
        <g:renderErrors bean="${postInstance}" as="list" />
      </div>
    </g:hasErrors>
    <g:form action="save" >
      <div class="dialog">
        <table>
          <tbody>

            <tr class="prop">
              <td valign="top" class="name">
                <label for="title"><g:message code="post.title.label" default="Title" /></label>
              </td>
              <td valign="top" class="value ${hasErrors(bean: postInstance, field: 'title', 'errors')}">
          <g:textField name="title" value="${postInstance?.title}" maxlength="${Post.constraints.title.getMaxSize()}"/>
          </td>
          </tr>

          <tr class="prop">
            <td valign="top" class="name">
              <label for="username"><g:message code="post.username.label" default="Username" /></label>
            </td>
            <td valign="top" class="value ${hasErrors(bean: postInstance, field: 'username', 'errors')}">
          <g:isLoggedIn>
            <p>${loggedInUserInfo(field:'username')}</p>
            <g:hiddenField name="username" value="${loggedInUserInfo(field:'username')} "/>
          </g:isLoggedIn>
          <g:isNotLoggedIn>
            <g:textField name="username" value="${postInstance?.username}" maxlength="${Post.constraints.username.getMaxSize()}"/>
          </g:isNotLoggedIn>
          </td>
          </tr>

          <tr class="prop">
            <td valign="top" colspan="2" class="value ${hasErrors(bean: postInstance, field: 'text', 'errors')}">
          <richui:richTextEditor name="text" value="${postInstance?.text}" height="500"/>
          </td>
          </tr>
          <tr class="prop">
            <td valign='bottom' class='name'><label for='code'>Enter Code: </label></td>
            <td valign='top' class='name'>
              <input type="text" name="captcha" size="8"/>
              <img src="${createLink(controller:'captcha', action:'index')}" align="absmiddle"/>
            </td>
          </tr>

          </tbody>
        </table>
      </div>
      <div class="buttons">
        <span class="button"><g:submitButton name="create" class="save" value="OK" /></span>
      </div>
    </g:form>
  </div>
</body>
</html>
